package com.wd.current.model.Utils

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.create
import java.util.concurrent.TimeUnit

/**
 * 作者: 张智聪
 * 时间: 2024/10/16
Time:  14:23
 * 描述:
 */
class HttpUtils {
 companion object{
   val httpUtils:HttpUtils by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
     HttpUtils()
   }
 }
 private val retrofit=Retrofit.Builder().baseUrl("http://10.59.9.24/")
  .client(OkHttpClient.Builder()
   .readTimeout(5,TimeUnit.SECONDS)
   .connectTimeout(5,TimeUnit.SECONDS)
   .addNetworkInterceptor(HttpLoggingInterceptor().apply {
     level=HttpLoggingInterceptor.Level.BODY
   }).build()
  ).addConverterFactory(GsonConverterFactory.create())
   .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
  .build()
val  aplis=retrofit.create<Aplis>()


 private val retrofit2=Retrofit.Builder().baseUrl("http://10.59.9.18/")
  .client(OkHttpClient.Builder()
   .readTimeout(5,TimeUnit.SECONDS)
   .connectTimeout(5,TimeUnit.SECONDS)
   .addNetworkInterceptor(HttpLoggingInterceptor().apply {
    level=HttpLoggingInterceptor.Level.BODY
   }).build()
  ).addConverterFactory(GsonConverterFactory.create())
  .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
  .build()
 val  aplis2=retrofit2.create<Aplis>()

}